<template>
  <div>
    <el-tree
      :data="menus"
      :expand-on-click-node="false"
      ref="tree"
      default-expand-all
      @node-click="handleNodeClick"
    />
  </div>
</template>
<script>
import { getMenuTree } from "@/api/console";
export default {
  components: {},
  data() {
    return {
      menus: [],
    };
  },
  created() {
    this.menuTreeList();
  },
  methods: {
    menuTreeList() {
      //this.loading = true;
      getMenuTree()
        .then((res) => {
          this.menus = res.data;
          this.loading = false;
        })
        .catch((msg) => {
          this.loading = false;
        });
    },
    handleNodeClick(data) {
      this.$emit("on-node-click", data);
    }
  },
};
</script>